package com.photovoltaic.auth.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.photovoltaic.auth.entity.Permission;
import com.photovoltaic.auth.entity.Role;
import com.photovoltaic.auth.entity.User;

import java.util.List;

public interface UserService extends IService<User> {
    
    User findByUsername(String username);
    
    boolean existsByUsername(String username);
    
    boolean existsByEmail(String email);
    
    List<Permission> getUserPermissions(Long userId);
    
    List<Role> getUserRoles(Long userId);
    
    boolean assignRole(Long userId, Long roleId);
    
    boolean removeRole(Long userId, Long roleId);
    
    /**
     * 更新用户权限
     * @param userId 用户ID
     * @param permissionKeys 权限标识符列表
     * @return 是否更新成功
     */
    boolean updateUserPermissions(Long userId, List<String> permissionKeys);
} 